package com.gk.panda.camera.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gk.panda.camera.service.ChenCameraShotLogService;
import com.gk.panda.pojo.ChenCameraShotLog;
import com.gk.panda.pojo.client.ShotLogListDTO;
import io.swagger.annotations.Api;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * @Description:
 * @author: wangchao74
 * @date: 2023/12/15 16:14
 * @version: 1.0
 **/
@RestController
@RequestMapping("/edmp/camera")
@Api(tags = "陈博士相机接口")
public class CameraController {

    @Autowired
    private ChenCameraShotLogService chenCameraShotLogService;

    @PostMapping
    public List<ChenCameraShotLog> listByDeviceId(@RequestBody ShotLogListDTO dto) {
        QueryWrapper<ChenCameraShotLog> wrapper = new QueryWrapper<>();
        wrapper.in(CollectionUtils.isNotEmpty(dto.getDeviceIds()), "ID", dto.getDeviceIds());
        wrapper.between("ReceiveTime", dto.getStartTime(), dto.getEndTime());
        return chenCameraShotLogService.list(wrapper);
    }

}
